package com.wise.service.cms.content.advice;

import com.wise.entities.content.SearchAdvice;
import com.wise.framework.dao.SqlSelect;
import com.wise.framework.daomodel.DaoPageList;
import com.wise.framework.restful.PageResultList;
import com.wise.summer.v1.cms.content.advice.ListAdvice;
import org.springframework.stereotype.Service;
import org.summerframework.model.SummerService;
import org.summerframework.model.SummerServiceBean;

/**
 * 批量查询推荐搜索关键字-链接
 *
 * @author Haoming Chen
 * Created on 2019/11/14
 */
@Service
@SummerService
public class ListAdviceService implements SummerServiceBean<ListAdvice> {

    @Override
    public void sum(ListAdvice model) {

        SqlSelect sqlSelect = SqlSelect.selec("*")
                .fromClassName(SearchAdvice.class)
                .eq(SearchAdvice._isDelete, false)
                //显示的数值排在列表上方, 不显示的数值排在列表下方
                .order_by(SearchAdvice._isActivate + " desc")
                //以优先值排序
                .order_by(SearchAdvice._sort);

        PageResultList<SearchAdvice> marketDealerList = DaoPageList.
                s(SearchAdvice.class, sqlSelect, model.getStart(), model.getLimit());
        model.setSummerResult(marketDealerList);

    }
}
